<?php




namespace App\Http\Controllers\Api\User;


use App\Http\Controllers\Api\BasicController;
use App\Models\OrderAppoint;
use App\Models\SiteCode;
use App\Models\User;
use App\Models\UserFocus;
use App\Models\UserInfo;
use App\Services\Sms;
use GatewayWorker\Lib\Gateway;
use Jiannei\Response\Laravel\Support\Facades\Response;
use Label84\HoursHelper\Facades\HoursHelper;

class TeacherController extends BasicController
{



    /**
     * @api {post} /teacher/skills 擅长领域
     * @apiName UserInfoLocation
     * @apiGroup UserInfo
     * @apiDescription
     * @apiHeader {String} Authorization='Bearer '
     */
    public function skills()
    {

    }

    /**
     * @api {post} /user/my-fans 我的粉丝
     * @apiName UserInfoLocation
     * @apiGroup UserInfo
     * @apiDescription
     * @apiHeader {String} Authorization='Bearer '
     */

    public function list(){
        $type = $this->request->input('type',1);
        $skill = $this->request->input('skill');
        $therapy = $this->request->input('therapy');
        $crowd = $this->request->input('crowd');
        $city = $this->request->input('city');
        $price = $this->request->input('price');
        $date = $this->request->input('date');
        $gender = $this->request->input('gender');
        $consult_types = $this->request->input('consult_types');
        $order = $this->request->input('order');
        $result=(new User())->teacherList($type,$skill,$therapy,$crowd,$city,$price,$date,$gender,$consult_types,$order);
        return Response::success($result);

    }
     public function comments(){
        $uid=$this->request->input('uid');
        $list=OrderAppoint::select(['user_id','appoint_id','comment','grade'])->where(['appoint_id'=>$uid,'status'=>5])
            ->with(['user'=>function($query){
            $query->select(['id','name','avatar']);
        }])->paginate(10);
        return Response::success($list);
     }
    public function openTime(){
        //'g:i A'
        $hours = HoursHelper::create('08:00', '22:00', 60);
        foreach ($hours as $k=>$hour){
            if($k==0) continue;
            $str= $hours[$k-1].'-'.$hour;
            $arr[]=$str;
        }
        return Response::success($arr);
    }


}
